export const types = {
  doc: ['doc', 'docx'],
  ppt: ['ppt', 'pptx'],
  xls: ['xls', 'xlsx'],
  video: ['mp4'],
  audio: ['mp3', 'wav', 'ogg'],
  txt: ['txt'],
  pdf: ['pdf'],
  zip: ['zip', 'rar'],
  json: ['json'],
  md: ['md'],
  img: ['jpg', 'jpeg', 'gif', 'png', 'bmp']
}
// 省市县 一级，二级，三级深度处理
export function deepRegion (options, deep = 1, regionType) {
  return options.map(({ name, children }) => {
    const item: any = { name }
    if (deep === regionType || children === null) {
      item.children = null
    } else {
      item.children = deepRegion(children, deep + 1, regionType)
    }
    return item
  })
}
export function getFormatDate (date: any, type?: string) {
  if (typeof date === 'string') {
    date = new Date(date)
  }
  const year = date.getFullYear()
  let month = date.getMonth()
  let day = date.getDate()
  month = month + 1 > 9 ? month + 1 : '0' + (month + 1)
  day = day > 9 ? day : '0' + day
  if (type === 'date') {
    return year + '-' + month + '-' + day
  }
  let hour = date.getHours()
  let minites = date.getMinutes()
  let second = date.getSeconds()
  hour = hour > 9 ? hour : '0' + hour
  minites = minites > 9 ? minites : '0' + minites
  second = second > 9 ? second : '0' + second
  return year + '-' + month + '-' + day + ' ' + hour + ':' + minites + ':' + second
}
